import java.io.IOException;
import java.net.DatagramPacket;
import java.net.InetAddress;
import java.net.MulticastSocket;


public class MulticastClient {

	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException {
		
		MulticastSocket receiver = new MulticastSocket(4444);
		receiver.joinGroup(InetAddress.getByName("224.0.0.255"));
		while (true) {
			byte[] buffer = new byte[256];
			DatagramPacket in = new DatagramPacket(buffer, buffer.length);
			receiver.receive(in);
			String received = new String(buffer,0,in.getLength());
			System.out.println(received);
		}
		receiver.leaveGroup(mcastaddr)
	}

}
